#!/usr/bin/python
# -*- coding: utf-8 -*-
# from flask import g

from flask import make_response,Flask
import subprocess

app = Flask(__name__)


@app.route('/', methods=['POST'])
def count():
    subprocess.call("git pull", shell=True)

    response = make_response("ok")
    response.headers['Access-Control-Allow-Origin'] = '*'
    response.headers['Access-Control-Allow-Methods'] = 'POST'
    response.headers['Access-Control-Allow-Headers'] = 'x-requested-with,content-type'
    response.headers['Content-Type'] = 'text/html; charset=utf-8'
    return response


if __name__ == '__main__':

    try:
        app.run(host='0.0.0.0', threaded=True, debug=False, port=7500)
    except Exception as e:
        print(e)
